<template>
  <div class="account-box page" ref="webview">
    <div ref="wrapper">
      <van-nav-bar title="账户管理" class="bg_white" left-arrow @click-left="$router.go(-1)" />
      <div class="content">
        <div class="cell-group">
          <div class="cell van-hairline--top" @click="$router.push({ path: '/bankcard'})">
            <div class="title">
              <span class="name">银行卡管理</span>
            </div>
            <div class="value isArrow">
            </div>
          </div>
          <div class="cell van-hairline--top" @click="goPassword(1)">
            <div class="title">
              <span class="name">登录密码</span>
            </div>
            <div class="value isArrow">
            </div>
          </div>
          <div class="cell van-hairline--top" @click="goPassword(2)">
            <div class="title">
              <span class="name">支付密码</span>
            </div>
            <div class="value isArrow">
            </div>
          </div>
        </div>
      </div>
      <div class="exit-login">
        <van-button class="exit" @click="exit">退出登录</van-button>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'account',
  data () {
    return {
    };
  },
  methods: {
    goPassword (type) {
      this.$router.push({ 'path': '/password/edit', query: { type: type } });
    },
    goSwitchAccount () {
      this.$router.push({ 'path': '/account/switch' });
    },
    exit () {
      this.$store.dispatch('exitLogin');
      localStorage.removeItem('Token');
      this.$router.push({ 'path': '/login' });
    },
    goRouter (path, query) {
      var routerQuery = { ...query };
      if (path === 'order/mall') {
        routerQuery = { isFromRoute: true };
      }
      if (path === 'declaration') {
        if (!this.userInfo.status) {
          return this.$toast('请先激活账号，请先购买产品激活账号。');
        }
        if (this.userInfo.scrStatus === -1 || this.userInfo.scrStatus === 1) {
          routerQuery = { type: !this.userInfo.is_service ? 1 : 2 };
        } else if (this.userInfo.scrStatus === 0 || this.userInfo.scrStatus === 2) {
          path = 'prompt';
          routerQuery = { type: this.userInfo.scrStatus === 0 ? 4 : 5 };
        }
      }
      this.$router.push({ path: '/' + path, query: routerQuery });
    }
  }
};
</script>
<style lang="less" scoped>
.account-box {
  .content {
    .c-1 {
      color: #917eff;
    }
  }
  .exit-login {
    position: fixed;
    bottom: calc(60px + env(safe-area-inset-bottom));
    left: 50px;
    right: 50px;
    .van-button__text {
      font-size: 34px;
    }
    .exit {
      width: 100%;
      height: 98px;
      border-radius: 98px;
      line-height: 98px;
      color: #125dff;
    }
  }
}
</style>
